package com.ruoyi.info.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.health.domain.Notice;
import com.ruoyi.health.service.INoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 养老资讯Controller
 * 
 * @author dalian
 * @date 2023-08-05
 */
@Api("前台：养老资讯-资讯管理")
@RestController
@RequestMapping("/info/healthNotice")
public class FrontNoticeController extends BaseController
{
    @Autowired
    private INoticeService noticeService;

    /**
     * 查询养老资讯列表【8.7已完成】
     * @param  cate1Id 一级分类id（二级分类id 在 notice中）
     */
    @ApiOperation("查询养老资讯列表")
    @GetMapping("/list")
    public TableDataInfo list(Notice notice,Long cate1Id)
    {
        startPage();
        //根据分类、标题，条件查询
        List<Notice> list = noticeService.selectNoticeList(notice,cate1Id);
        return getDataTable(list);
    }

    /**
     * 获取养老资讯信息
     */
    @ApiOperation("获取养老资讯信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(noticeService.selectNoticeById(id));
    }



}
